<template>
  <div @mouseover="showset" @mouseout="hideset" :style="{color:moddata.config.fontcolor}" class="mod">
    <div>
      <div class="con">
        <div class="title" v-show="moddata.config.titleshow">
          <span>
            <i class="iconfont icon-people_fill"></i>&nbsp;{{moddata.config.title}}</span>
        </div>
        <div class="text">
          <div class="qrcode">
            <img :src="qrCodeImgSrc" alt="">
          </div>
          <div class="desc">
            <p class="p-1">微信扫码</p>
            <p class="p-2">手机查阅主办方</p>
          </div>
        </div>
      </div>
    </div>
    <div class="mask" v-show="maskshow">
      <div class="settingbtn" @click="headset">
        <i class="el-icon-setting"></i> 设置</div>
      <div class="deletebtn" @click="deletemod">
        <i class="el-icon-delete"></i> 删除</div>
    </div>
  </div>
</template>

<script>
  import {
    mapState,
  } from 'vuex'
  export default {
    props: ["moddata", "index"],
    data: function () {
      return {
        maskshow: false
      }
    },
    methods: {
      showset: function () {
        this.maskshow = true;
      },
      hideset: function () {
        this.maskshow = false;
      },
      headset: function () {
        this.$store.commit({
          type: 'showsetbox',
          setMod: 'setShowMod',
          index: this.index
        })
      },
      deletemod: function () {
        this.$store.dispatch('deleteMod', this.index)
      },
    },
    computed: {
      ...mapState([
        "parameters"
      ]),
      qrCodeImgSrc() {
        var ewmUrl = window.location.protocol + "//" + window.location.host +
          "/Event/Sponsor/Sponsor?sponsorId=" + this.parameters.sponsorId;
        var qrCodeImgSrc = "/MicroSurvey/Home/GetQrCode?enCodeUrl=" + encodeURIComponent(ewmUrl);
        return qrCodeImgSrc
      }
    }
  }
</script>

<style scoped lang="less">
  .mod {
    position: relative;
  }

  .con {
    border: 1px solid #eaeaea;
  }

  .text {
    background: #ffffff;
    padding: 30px 0;
    position: relative;
    .qrcode {
      position: absolute;
      top: 30px;
      left: 43px;
      width: 115px;
      height: 115px;
      img {
        height: 100%;
        width: 100%;
      }
    }
    .desc {
      height: 115px;
      margin-left: 158px;
      color: #616161;
      .p-1 {
        padding: 28px 0 20px 20px;
      }
      .p-2 {
        padding-left: 20px;
      }
    }
  }

  .title {
    padding: 0 20px;
    height: 40px;
    font-size: 16px;
    color: #434343;
    background: #f8f8f8;
    line-height: 40px;
    .iconfont {
      display: none;
    }
  }
</style>